﻿
namespace SharpDepend
{
    /// <summary>
    /// Buttons for a dialog.
    /// </summary>
    public enum DialogButtons : byte
    {
        OK = 0,
        YesNo = 1,
        OKCancel = 2
    }

    /// <summary>
    /// Button result for a dialog.
    /// </summary>
    public enum DialogButtonResult : byte
    {
        OK = 0,
        Yes = 1,
        No = 2,
        Cancel
    }

    public enum DialogIcon
    {
        None,
        Warning,
		Error,
        Question
    }

    /// <summary>
    /// Dialog result. It will tell which button user was clicked on.
    /// </summary>
    /// <param name="clickedButton">Clicked button.</param>
    /// <param name="parameter">Optional parameter object.</param>
    public delegate void DialogResultCallback(DialogButtonResult clickedButton, object parameter);

    public delegate void DialogOpenSaveFileDialoigCallback(bool success, string file, object parameter);

    public delegate void DialogInputDialoigCallback(bool success, string input, object parameter);

    public abstract class IDialogManager
    {
        /// <summary>
        /// Show a simple OK dialog.
        /// </summary>
        /// <param name="message">Dialog message.</param>
        /// <param name="title">Dialog title.</param>
        /// <param name="dialogIcon">Dialog icon.</param>
        public void Show(string message, string title, DialogIcon dialogIcon)
        {
            Show(message, title, DialogButtons.OK, dialogIcon, null, null);
        }

        /// <summary>
        /// Show a simple OK dialog.
        /// </summary>
        /// <param name="message">Dialog message.</param>
        /// <param name="title">Dialog title.</param>
        /// <param name="dialogIcon">Dialog icon.</param>
        /// <param name="result">Callback result. Set null you want no result back.</param>
        public void Show(string message, string title, DialogIcon dialogIcon, DialogResultCallback result)
        {
            Show(message, title, DialogButtons.OK, dialogIcon, result, null);
        }

        /// <summary>
        /// Show a dialog with alternative buttons and a null parameter as default.
        /// </summary>
        /// <param name="message">Dialog message.</param>
        /// <param name="title">Dialog title.</param>
        /// <param name="dialogButtons">Dialog combined buttons.</param>
        /// <param name="dialogIcon">Dialog icon.</param>
        /// <param name="result">Callback result. Set null you want no result back.</param>
        public void Show(string message, string title, DialogButtons dialogButtons,  DialogIcon dialogIcon, DialogResultCallback result)
        {
            Show(message, title, dialogButtons, dialogIcon, result, null);
        }

        /// <summary>
        /// Show a dialog for user.
        /// </summary>
        /// <param name="message">Dialog message.</param>
        /// <param name="title">Dialog title.</param>
        /// <param name="dialogButtons">Dialog combined buttons.</param>
        /// <param name="dialogIcon">Dialog icon.</param>
        /// <param name="result">Callback result. Set null you want no result back.</param>
        /// <param name="parameter">Optional extra parameter object. It can bu null.</param>
        public abstract void Show(string message, string title, DialogButtons dialogButtons, DialogIcon dialogIcon, DialogResultCallback result, object parameter);

        /// <summary>
        /// Show a input dialog.
        /// </summary>
        /// <param name="label">Label of the input dialog.</param>
        /// <param name="title">Title of the input dialog.</param>
        /// <param name="defaultInput">Default input text.</param>
        /// <param name="result">Callback result. Set null you want no result back.</param>
        /// <param name="parameter">Optional extra parameter object. It can bu null.</param>
        public abstract void Input(string label, string title, string defaultInput, DialogInputDialoigCallback result, object parameter);

        public abstract void OpenFile(string title, string extensions, string defaultPath, DialogOpenSaveFileDialoigCallback result, object parameter);

        public abstract void SaveFile(string title, string extensions, string defaultPath, DialogOpenSaveFileDialoigCallback result, object parameter);
        
        public abstract void OpenFolder(string title, string defaultPath, DialogOpenSaveFileDialoigCallback result, object parameter);
    }
}
